/*
获取当前年的第一月，2022-01-01
 */
export function getYearBeginMonth(){
    let  dd = new Date();
    let  mYear = dd.getFullYear() ;
    let  sret = mYear+'-01-01';
    return sret;
  }
  /*
获取当前日期，2022-10-29 如果当前日期前一天，则参数为-1，当天为0，后一天为1
 */
export function  getNowDate(days){
    let dd = new Date();
    dd.setDate(dd.getDate()+days);//获取days天后的日期
    let mYear = dd.getFullYear()+'' ;
    let mMonth = dd.getMonth() + 1;//获取当前月份的日期
    let mDay = dd.getDate();

    let  mdate = mYear;
    if (mMonth < 10) {
      mdate = mdate + '-0' + mMonth;
    }
    else {
      mdate = mdate + '-' + mMonth;
    }
    if (mDay < 10) {
      mdate = mdate + '-0' + mDay;
    }
    else {
      mdate = mdate + '-' + mDay;
    }
    return mdate;
  }
export function  getNowDateTime(days){
  let dd = new Date();
  dd.setDate(dd.getDate()+days);//获取days天后的日期
  let mYear = dd.getFullYear()+'' ;
  let mMonth = dd.getMonth() + 1;//获取当前月份的日期
  let mDay = dd.getDate();
  let mHours=dd.getHours()
  let mMinutes=dd.getMinutes()
  let mSeconds=dd.getSeconds()

  let  mdate = mYear;
  if (mMonth < 10) {
    mdate = mdate + '-0' + mMonth;
  }
  else {
    mdate = mdate + '-' + mMonth;
  }
  if (mDay < 10) {
    mdate = mdate + '-0' + mDay;
  }
  else {
    mdate = mdate + '-' + mDay;
  }
  return mdate+' '+mHours+':'+mMinutes+':'+mSeconds;
}
